package com.metagurukul.informer.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.metagurukul.informer.utility.ConnectionFactory;

public class QuestionTagMappingDAO {

    
    /**
     * ...Method to insert a row for question tag relation
     * @param question_id
     * @param tag_id
     */
	public void insert(int question_id, int tag_id) throws SQLException {
		
		Connection con= ConnectionFactory.getInstance();
		String sql = "insert into question_tag_mapping values(?,?)";
		PreparedStatement ps = null;
		ps = con.prepareStatement(sql);
		ps.setInt(1,tag_id);
		ps.setInt(2,question_id);
		int result = ps.executeUpdate();
		//System.out.println(result + " rows updated");
		
		if(ps!=null){
	   		ps.close();
		}	   	
		if(con!=null){
			con.close();
		}
		
	}

}
